<?php
use app\modules\clinical\models\Patient;
use app\modules\clinical\models\ExcelPd;

$append = ExcelPd::getMedList('pd');
$med = $model->excel->getMedCtns();
?>

  <!-- 第三部分 -->
  <tr class="title">
      <td colspan="6"><h4>一、患者信息与表格信息</h4></td>
  </tr>
  <tr>
      <th>姓名</th>
      <td><?= ($model->rel_id == 0) ? Yii::$app->session->get('pt_name') : Patient::findOne(['pk_id'=>$model->pt_id])->pt_name ?></td>
      <th>与患者关系</th>
      <td colspan="3"><?= ($model->rel_id == 0) ? '本人' : Patient::getParams('relation')[$rel[$model->pt_id]] ?></td>
  </tr>
  <tr>
      <th>创建人</th>
      <td><?= $model->crt_name ?></td>
      <th>创建时间</th>
      <td colspan="3"><?= $model->crt_time ?></td>
  </tr>
  <tr>
      <th>修改人</th>
      <td><?= $model->update_name ?></td>
      <th>修改时间</th>
      <td colspan="3"><?= $model->update_at ?></td>
  </tr>
  <tr>
      <th>评估日期</th>
      <td colspan="5"><?= $model->evaluation_time ?></td>
  </tr>
  <tr class="title">
      <td colspan="6"><h4>二、治疗信息</h4></td>
  </tr>
  <tr>
      <th>H-Y分级</th>
      <td colspan="3"><?= $model->excel->classify ?></td>
      <th>早餐时间</th>
      <td ><?= $model->excel->bf_time ?></td>
  </tr>
  <tr>
      <th>中餐时间</th>
      <td ><?= $model->excel->lc_time ?></td>
      <th>晚餐时间</th>
      <td><?= $model->excel->dn_time ?></td>
      <th>睡觉时间</th>
      <td><?= $model->excel->sp_time ?></td>
      
  </tr>
  <tr>
      <th>起床时间</th>
      <td ><?= $model->excel->up_time ?></td>
      <th>创建人</th>
      <td ><?= $model->crt_name ?></td>
      <th>创建时间</th>
      <td ><?= $model->crt_time ?></td>
  </tr>
  <tr>
      <th>希望解决的问题</th>
      <td ><?= $model->excel->pbm_solve ?></td>
  </tr>
  <tr>
      <td colspan="6" class="medCtn-view">
      <table class="table-bordered">
      <tr>
          <td rowspan="2"><b>药物名称</b></td>
          <td colspan="7"><b>上午</b></td>
          <td colspan="10"><b>下午</b></td>
      </tr>
      <tr>
      <?php for ($i = 6; $i < 23; $i ++) : ?>
          <td><?= $i ?></td>
      <?php endfor;?>
      </tr>
      <?php foreach ($append as $list) : ?>
      <tr>
          <td><?= $list['med_name'] ?></td>
          <?php for ($i = 6; $i < 23; $i ++) : ?>
              <td><?= empty($med[$list['pk_id']][$i]) ? '' : $med[$list['pk_id']][$i] ?></td>
          <?php endfor;?>
      </tr>
      <?php endforeach; ?>
      </table>
      </td>
  </tr>
  <tr>
      <th>其他用药</th>
      <td colspan="5"><?= $model->excel->else_ctnt ?></td>
  </tr>